package cn.iocoder.yudao.module.artifact.dal.mysql.info;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.artifact.dal.dataobject.info.InfoImageDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.artifact.controller.admin.info.vo.*;

/**
 * 文玩图片 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface InfoImageMapper extends BaseMapperX<InfoImageDO> {

    default PageResult<InfoImageDO> selectPage(InfoImagePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InfoImageDO>()
                .eqIfPresent(InfoImageDO::getArtifactId, reqVO.getArtifactId())
                .likeIfPresent(InfoImageDO::getName, reqVO.getName())
                .betweenIfPresent(InfoImageDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InfoImageDO::getId));
    }
    default List<InfoImageDO> selectListByArtifactId(Long artifactId) {
        return selectList(InfoImageDO::getArtifactId, artifactId);
    }

    default int deleteByArtifactId(Long artifactId) {
        return delete(InfoImageDO::getArtifactId, artifactId);
    }

}